
package managedbean;


import entity.Employee;
import entity.Inquiry;
import entity.Message;
import java.util.ArrayList ;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import org.primefaces.model.MenuModel;
import entity.Customer;
import entity.Invoice;
import entity.Job;
import entity.Lead;
import entity.MaterialRequirementPlan;
import entity.Payment;
import entity.ProductionSchedule;
import entity.Product;
import entity.ProductionBatch;
import entity.ProductionScheduleDay;
import entity.PurchaseItem;
import entity.PurchaseOrder;
import entity.Quotation;
import entity.RawMaterial;
import entity.RawMaterialDelivery;
import entity.RawMaterialPurchaseOrder;
import entity.SalesForecast;
import entity.SalesOrder;
import entity.Shipping;
import entity.Supplier;
import entity.Warehouse;
import entity.WarehouseZone;
import java.util.List;
import flanagan.analysis.Regression;



@ManagedBean(name = "userSessionManagerBean")
@SessionScoped
public class UserSessionManagerBean {

    private static String userId =null;
    private String name;
    private Message selectedMessage;
    private String messageType = "Inbox";
    private String receivers;
    private String status;
    private String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
    private String serverPort = "8080";
    private static Object selectedItem;
    private Employee selectedContact;
    private Inquiry selectedInquiry;
    private Customer selectedCustomer;
    private Lead selectedLead;
    private Job selectedJob;
    private Quotation selectedQuotation;
    private PurchaseOrder selectedPurchaseOrder;
    private boolean viewCustomerInquiries;
    private static MenuModel model;
    private static ArrayList <String> addressList;
    private Customer customer;
    private String request;
    private Boolean OTP = true;
    private SalesOrder selectedSalesOrder;
    private SalesOrder selectedSalesOrder2;
    private Object parameters;
    private ArrayList <SalesForecast> salesForecasts;
    private List<PurchaseItem> purchaseItems;
    private Regression selectedRegression;
    private Product selectedProduct; 
    private ProductionSchedule selectedProductionSchedule;
    private RawMaterial selectedRawMaterial;
    private Payment selectedPayment; 
    private Invoice selectedInvoice;
    private ArrayList <ProductionSchedule> productionSchedules;
    private Supplier selectedSupplier;
    private Warehouse selectedWarehouse;
    private WarehouseZone selectedWarehouseZone;
    private ProductionBatch selectedProductionBatch;
    private List<ProductionBatch> productionBatches = new ArrayList<ProductionBatch>();
    private Shipping selectedShippingOrder;
    private ArrayList <ProductionScheduleDay> productionInfoDays;
    private String selectedDay;
    private MaterialRequirementPlan[] selectedMaterialRequirementPlans;
    private RawMaterialPurchaseOrder selectedRawMaterialPurchaseOrder;
    private RawMaterialDelivery selectedRawMaterialDelivery;
    
    /** Creates a new instance of UserSessionManagerBean */
    public UserSessionManagerBean() {
    }

    /**
     * @return the selectedMessage
     */
    public Message getSelectedMessage() {
        return selectedMessage;
    }

    /**
     * @param selectedMessage the selectedMessage to set
     */
    public void setSelectedMessage(Message selectedMessage) {
        this.selectedMessage = selectedMessage;
    }

    /**
     * @return the messageType
     */
    public String getMessageType() {
        return messageType;
    }

    /**
     * @param messageType the messageType to set
     */
    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    /**
     * @return the receivers
     */
    public String getReceivers() {
        return receivers;
    }

    /**
     * @param receivers the receivers to set
     */
    public void setReceivers(String receivers) {
        this.receivers = receivers;
    }

    /**
     * @return the status
     */
    public String getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * @return the serverName
     */
    public String getServerName() {
        return serverName;
    }

    /**
     * @param serverName the serverName to set
     */
    public void setServerName(String serverName) {
        this.serverName = serverName;
    }

    /**
     * @return the serverPort
     */
    public String getServerPort() {
        return serverPort;
    }

    /**
     * @param serverPort the serverPort to set
     */
    public void setServerPort(String serverPort) {
        this.serverPort = serverPort;
    }

    /**
     * @return the userId
     */
    public String getUserId() {
        return userId;
    }

    /**
     * @param userId the userId to set
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }

   

    /**
     * @return the AddressList
     */
    public static ArrayList <String> getAddressList() {
        return addressList;
    }

    /**
     * @param aAddressList the AddressList to set
     */
    public static void setAddressList(ArrayList <String> aAddressList) {
        addressList = aAddressList;
    }
    
    /**
     * @return the selectedUser
     */
    public Object getSelectedItem() {
        return selectedItem;
    }

  
    public void setSelectedItem(Object selectedItem) {
        this.selectedItem = selectedItem;
    }
    
    public Employee getSelectedContact() {
        return selectedContact;
    }


    public void setSelectedContact(Employee selectedContact) {
        this.selectedContact = selectedContact;

    }
    
       public MenuModel getModel() {
        return model;
    }

    public void setModel(MenuModel model) {
        this.model = model;
    }

    /**
     * @return the selectedInquiry
     */
    public Inquiry getSelectedInquiry() {
        return selectedInquiry;
    }

    /**
     * @param selectedInquiry the selectedInquiry to set
     */
    public void setSelectedInquiry(Inquiry selectedInquiry) {
        this.selectedInquiry = selectedInquiry;
    }

    /**
     * @return the selectedLead
     */
    public Lead getSelectedLead() {
        return selectedLead;
    }

    /**
     * @param selectedLead the selectedLead to set
     */
    public void setSelectedLead(Lead selectedLead) {
        this.selectedLead = selectedLead;
    }
    
     /**
     * @return the customer
     */
    public  Customer getCustomer() {
        return customer;
    }

    /**
     * @param aCustomer the customer to set
     */
    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    /**
     * @return the selectedCustomer
     */
    public Customer getSelectedCustomer() {
        return selectedCustomer;
    }

    /**
     * @param selectedCustomer the selectedCustomer to set
     */
    public void setSelectedCustomer(Customer selectedCustomer) {
        this.selectedCustomer = selectedCustomer;
    }

    /**
     * @return the viewCustomerInquiries
     */
    public boolean isViewCustomerInquiries() {
        return viewCustomerInquiries;
    }

    /**
     * @param viewCustomerInquiries the viewCustomerInquiries to set
     */
    public void setViewCustomerInquiries(boolean viewCustomerInquiries) {
        this.viewCustomerInquiries = viewCustomerInquiries;
    }

    /**
     * @return the selectedQuotation
     */
    public Quotation getSelectedQuotation() {
        return selectedQuotation;
    }

    /**
     * @param selectedQuotation the selectedQuotation to set
     */
    public void setSelectedQuotation(Quotation selectedQuotation) {
        this.selectedQuotation = selectedQuotation;
    }

    /**
     * @return the selectedJob
     */
    public Job getSelectedJob() {
        return selectedJob;
    }

    /**
     * @param selectedJob the selectedJob to set
     */
    public void setSelectedJob(Job selectedJob) {
        this.selectedJob = selectedJob;
    }

    /**
     * @return the request
     */
    public String getRequest() {
        return request;
    }

    /**
     * @param request the request to set
     */
    public void setRequest(String request) {
        this.request = request;
    }

    /**
     * @return the selectedPurchaseOrder
     */
    public PurchaseOrder getSelectedPurchaseOrder() {
        return selectedPurchaseOrder;
    }

    /**
     * @param selectedPurchaseOrder the selectedPurchaseOrder to set
     */
    public void setSelectedPurchaseOrder(PurchaseOrder selectedPurchaseOrder) {
        this.selectedPurchaseOrder = selectedPurchaseOrder;
    }
    
      /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
    
    
    
    public void clearSession ()
    {   
        
        selectedItem =null;
        selectedContact=null;
        selectedInquiry =null;
        selectedCustomer=null;
        selectedLead = null;
        selectedJob = null;
        selectedQuotation = null;
        selectedPurchaseOrder =null;
        selectedCustomer = null;
        messageType = "Inbox";
        request = null;
        customer = null;
        status = null;
        parameters =null;
        salesForecasts = null;
        selectedRegression = null;
        productionSchedules = null;
    }

    /**
     * @return the OTP
     */
    public Boolean getOTP() {
        return OTP;
    }

    /**
     * @param OTP the OTP to set
     */
    public void setOTP(Boolean OTP) {
        this.OTP = OTP;
    }

    /**
     * @return the selectedSalesOrder
     */
    public SalesOrder getSelectedSalesOrder() {
        return selectedSalesOrder;
    }

    /**
     * @param selectedSalesOrder the selectedSalesOrder to set
     */
    public void setSelectedSalesOrder(SalesOrder selectedSalesOrder) {
        this.selectedSalesOrder = selectedSalesOrder;
    }

    /**
     * @return the parameters
     */
    public Object getParameters() {
        return parameters;
    }

    /**
     * @param parameters the parameters to set
     */
    public void setParameters(Object parameters) {
        this.parameters = parameters;
    }

    /**
     * @return the salesForecasts
     */
    public ArrayList <SalesForecast> getSalesForecasts() {
        return salesForecasts;
    }

    /**
     * @param salesForecasts the salesForecasts to set
     */
    public void setSalesForecasts(ArrayList <SalesForecast> salesForecasts) {
        this.salesForecasts = salesForecasts;
    }
    
    public List<PurchaseItem> getPurchaseItems() {
        return purchaseItems;
    }
    
    public Regression getSelectedRegression() {
        return selectedRegression;
    }

    public void setPurchaseItems(List<PurchaseItem> purchaseItems) {
        this.purchaseItems = purchaseItems;
    }
    public void setSelectedRegression(Regression selectedRegression) {
        this.selectedRegression = selectedRegression;
    }

    /**
     * @return the selectedSalesOrder2
     */
    public SalesOrder getSelectedSalesOrder2() {
        return selectedSalesOrder2;
    }

    /**
     * @param selectedSalesOrder2 the selectedSalesOrder2 to set
     */
    public void setSelectedSalesOrder2(SalesOrder selectedSalesOrder2) {
        this.selectedSalesOrder2 = selectedSalesOrder2;
    }


    public ArrayList <ProductionSchedule> getProductionSchedules() {
        return productionSchedules;
    }
    
    public Product getSelectedProduct() {
        return selectedProduct;
    }


    public void setProductionSchedules(ArrayList <ProductionSchedule> productionSchedules) {
        this.productionSchedules = productionSchedules;
    }
    
    public void setSelectedProduct(Product selectedProduct) {
        this.selectedProduct = selectedProduct;
    }

    public ProductionSchedule getSelectedProductionSchedule() {
        return selectedProductionSchedule;
    }
    
    public Payment getSelectedPayment() {
        return selectedPayment;
    }


    public void setSelectedProductionSchedule(ProductionSchedule selectedProductionSchedule) {
        this.selectedProductionSchedule = selectedProductionSchedule;
    }
    public void setSelectedPayment(Payment selectedPayment) {
        this.selectedPayment = selectedPayment;
    }

    /**
     * @return the selectedInvoice
     */
    public Invoice getSelectedInvoice() {
        return selectedInvoice;
    }

    /**
     * @param selectedInvoice the selectedInvoice to set
     */
    public void setSelectedInvoice(Invoice selectedInvoice) {
        this.selectedInvoice = selectedInvoice;
    }

    /**
     * @return the selectedRawMaterial
     */
    public RawMaterial getSelectedRawMaterial() {
        return selectedRawMaterial;
    }

    /**
     * @param selectedRawMaterial the selectedRawMaterial to set
     */
    public void setSelectedRawMaterial(RawMaterial selectedRawMaterial) {
        this.selectedRawMaterial = selectedRawMaterial;
    }

    /**
     * @return the selectedSuppler
     */
    public Supplier getSelectedSupplier() {
        return selectedSupplier;
    }

    /**
     * @param selectedSuppler the selectedSuppler to set
     */
    public void setSelectedSupplier(Supplier selectedSupplier) {
        this.selectedSupplier = selectedSupplier;
    }

    /**
     * @return the selectedWarehouse
     */
    public Warehouse getSelectedWarehouse() {
        return selectedWarehouse;
    }

    /**
     * @param selectedWarehouse the selectedWarehouse to set
     */
    public void setSelectedWarehouse(Warehouse selectedWarehouse) {
        this.selectedWarehouse = selectedWarehouse;
    }

    /**
     * @return the selectedWarehouseZone
     */
    public WarehouseZone getSelectedWarehouseZone() {
        return selectedWarehouseZone;
    }

    /**
     * @param selectedWarehouseZone the selectedWarehouseZone to set
     */
    public void setSelectedWarehouseZone(WarehouseZone selectedWarehouseZone) {
        this.selectedWarehouseZone = selectedWarehouseZone;
    }

    /**
     * @return the selectedProductionBatch
     */
    public ProductionBatch getSelectedProductionBatch() {
        return selectedProductionBatch;
    }

    /**
     * @param selectedProductionBatch the selectedProductionBatch to set
     */
    public void setSelectedProductionBatch(ProductionBatch selectedProductionBatch) {
        this.selectedProductionBatch = selectedProductionBatch;
    }

    /**
     * @return the productionBatches
     */
    public List<ProductionBatch> getProductionBatches() {
        return productionBatches;
    }

    /**
     * @param productionBatches the productionBatches to set
     */
    public void setProductionBatches(List<ProductionBatch> productionBatches) {
        this.productionBatches = productionBatches;
    }

    /**
     * @return the selectedShippingOrder
     */
    public Shipping getSelectedShippingOrder() {
        return selectedShippingOrder;
    }

    /**
     * @param selectedShippingOrder the selectedShippingOrder to set
     */
    public void setSelectedShippingOrder(Shipping selectedShippingOrder) {
        this.selectedShippingOrder = selectedShippingOrder;
    }

    /**
     * @return the productionInfoDays
     */
    public ArrayList <ProductionScheduleDay> getProductionInfoDays() {
        return productionInfoDays;
    }

    /**
     * @param productionInfoDays the productionInfoDays to set
     */
    public void setProductionInfoDays(ArrayList <ProductionScheduleDay> productionInfoDays) {
        this.productionInfoDays = productionInfoDays;
    }

    /**
     * @return the selectedDay
     */
    public String getSelectedDay() {
        return selectedDay;
    }

    /**
     * @param selectedDay the selectedDay to set
     */
    public void setSelectedDay(String selectedDay) {
        this.selectedDay = selectedDay;
    }

    /**
     * @return the selectedMaterialRequirementPlans
     */
    public MaterialRequirementPlan[] getSelectedMaterialRequirementPlans() {
        return selectedMaterialRequirementPlans;
    }

    /**
     * @param selectedMaterialRequirementPlans the selectedMaterialRequirementPlans to set
     */
    public void setSelectedMaterialRequirementPlans(MaterialRequirementPlan[] selectedMaterialRequirementPlans) {
        this.selectedMaterialRequirementPlans = selectedMaterialRequirementPlans;
    }

    /**
     * @return the selectedRawMaterialPurchaseOrder
     */
    public RawMaterialPurchaseOrder getSelectedRawMaterialPurchaseOrder() {
        return selectedRawMaterialPurchaseOrder;
    }

    /**
     * @param selectedRawMaterialPurchaseOrder the selectedRawMaterialPurchaseOrder to set
     */
    public void setSelectedRawMaterialPurchaseOrder(RawMaterialPurchaseOrder selectedRawMaterialPurchaseOrder) {
        this.selectedRawMaterialPurchaseOrder = selectedRawMaterialPurchaseOrder;
    }

    /**
     * @return the selectedRawMaterialDelivery
     */
    public RawMaterialDelivery getSelectedRawMaterialDelivery() {
        return selectedRawMaterialDelivery;
    }

    /**
     * @param selectedRawMaterialDelivery the selectedRawMaterialDelivery to set
     */
    public void setSelectedRawMaterialDelivery(RawMaterialDelivery selectedRawMaterialDelivery) {
        this.selectedRawMaterialDelivery = selectedRawMaterialDelivery;
    }
}
